<template>
  <div id="app">
    <el-container>
      <el-header>LD.emp.CRUD</el-header>
      <el-container>
        <el-aside width="200px">
          <el-menu background-color="#545c64"
                   text-color="#fff"
                   active-text-color="#ffd04b">
            <el-menu-item index="3">
            <span slot="title" style="font:16px 微软雅黑;margin-left: -14px;">
              <span style="font:24px 楷体;color:deepskyblue"></span>-后台管理
            </span>
            </el-menu-item>
          </el-menu>
          <el-menu
              router
              :default-active="this.$route.path"
              class="el-menu-vertical-demo"
              background-color="#545c64"
              text-color="#fff"
              active-text-color="#ffd04b">
            <el-submenu index="1" v-for="m in menus" :key="m.index">
              <template slot="title">
                <i :class="m.icon"></i>
                <span @click="title1=m.title">{{m.title}}</span>
              </template>
              <el-menu-item-group>
                <el-menu-item :index="m.path + '/' + child.path" @click="title1=m.title;title2=child.title" v-for="child in m.children" :key="child.index">{{child.title}}</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>{{title1}}</el-breadcrumb-item>
            <el-breadcrumb-item>{{title2}}</el-breadcrumb-item>
          </el-breadcrumb>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<style>
*{
  padding:0;
  margin:0
}
.el-menu-item.submenu{
  text-indent: 4em;
}
.el-menu,.el-menu-item{
  border-right:0!important;
}
.el-header, .el-footer {
  background-color: rgb(84,92,100);
  color: white;
  text-align: right;
  line-height: 60px;
}

.el-aside {
  background-color: #D3DCE6;
  color: #333;
  text-align: center;
  height: 800px;
}

.el-main {
  background-color: #E9EEF3;
  color: #333;
  text-align: center;

}
.el-menu-item{
  text-indent: 4em;;
}
</style>

<script>
import menus from "../api/menus";
export default {
  name:'app',
  data(){
    return {
      menus:menus,
      title1:'',
      title2:'',
    }
  }
}
</script>
